﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using AnQinFrameWorkAPI.Common.Enum;

namespace AnQinFrameWorkAPI.Entity.SystemCore.Entity;

/// <summary>
///     编码规则子表模型
/// </summary>
[Table("CodeRuleItem")]
public class CodeRuleItemModel
{
    #region 关联

    /// <summary>
    ///     编码规则
    /// </summary>
    public virtual CodeRuleModel CodeRule { get; set; }

    #endregion

    #region 字段

    /// <summary>
    ///     编码规则子表id
    /// </summary>
    [Key]
    [MaxLength(36)]
    public Guid Id { get; set; }

    /// <summary>
    ///     编码规则id
    /// </summary>
    [MaxLength(36)]
    public Guid CodeRuleId { get; set; }

    /// <summary>
    ///     排序
    /// </summary>
    public int Order { get; set; }

    /// <summary>
    ///     编码类型
    /// </summary>
    public SystemCoreEnum.CodeTypeEnum CodeType { get; set; }

    /// <summary>
    ///     常量值
    /// </summary>
    [MaxLength(50)]
    public string? Constant { get; set; }

    /// <summary>
    ///     时间类型
    /// </summary>
    public SystemCoreEnum.DateTypeEnum? DateType { get; set; }

    /// <summary>
    ///     流水号长度
    /// </summary>
    public int? SerialLength { get; set; }

    /// <summary>
    ///     流水号初始值
    /// </summary>
    public int? InitSerialNumber { get; set; }

    /// <summary>
    ///     当前流水号
    /// </summary>
    public int? CurrentSerialNumber { get; set; }

    /// <summary>
    ///     流水号刷新规则
    /// </summary>
    public SystemCoreEnum.RefreshDateTypeEnum? SerialRefreshDateType { get; set; }

    /// <summary>
    ///     上次刷新时间
    /// </summary>
    public DateTime? LastRefreshTime { get; set; }

    #endregion
}